#define DEBUG
#include <cstdio>

using namespace std;

typedef long long ll;

const int maxn=100000, mods=1000000007;

ll qpower(ll a, int n) {
  ll s=1;
  for (; n; n/=2) {
    if (n&1) {
      s = s*a%mods;
    }
    a = a*a%mods;
  }
  return s;
}

ll fact[maxn+1], unfact[maxn+1];

void initFact(int n) {
  fact[0] = 1;
  for (int i=1; i<=n; i++) {
    fact[i] = fact[i-1]*i%mods;
  }
  unfact[n] = qpower(fact[n], mods-2);
  for (int i=n; i>0; i--) {
    unfact[i-1] = unfact[i]*i%mods;
  }
}

ll c(int n, int m) {
  return fact[n]*unfact[m]%mods*unfact[n-m]%mods;
}

int main() {
  freopen("stone.in", "r", stdin);
  freopen("stone.out", "w", stdout);

  static int x[maxn+1], cnt[5], ans[4];
  int n, a, b, t=0;
  scanf("%d %d %d", &n, &a, &b);
  if (a>b) {
    t = a, a = b, b = t;
    t = 1;
  }
  for (int i=1; i<=n; i++) {
    scanf("%d", x+i);
    x[i] %= a+b;
    if (x[i]<a) {
      cnt[1]++;
    } else if (a<=x[i] && x[i]<b) {
      cnt[2]++;
    } else if (b<=x[i] && x[i]<2*a) {
      cnt[3]++;
    } else {
      cnt[4]++;
    }
  }
  initFact(n);

  ll f=0, g=0, h=qpower(2, cnt[1]);
  for (int i=1; i<=cnt[3]; i+=2) {
    f = (f+c(cnt[3], i))%mods;
  }
  for (int i=0; i<=cnt[3]; i+=2) {
    g = (g+c(cnt[3], i))%mods;
  }

  ans[3] = h*g%mods;
  ans[2] = (h*f%mods+h*g%mods*cnt[4]%mods)%mods;
  ans[t] = (qpower(2, n)+2*mods-ans[3]-ans[2])%mods;
  for (int i=0; i<4; i++) {
    printf("%d ", ans[i]);
  }

  fclose(stdin);
  fclose(stdout);
  return 0;
}
